<script>
import cellGroup from './uni_modules/uview-plus/components/u-cell-group/cellGroup';
import {uploadJugle} from "./api/index"
import {
	useMyStore
} from './store/index'
	export default {
		onLaunch: function() {
			console.log('App Launch');
			// 协议
			uni.removeStorageSync('isChecked')
			
			// 计算高度
			const systemInfo = uni.getSystemInfoSync();
			const pdHight = systemInfo.screenHeight - systemInfo.safeArea.bottom;
			this.globalData.pdHight = pdHight;
			console.log('底部安全区域:', pdHight);
			console.log('systemInfo:', systemInfo);
			const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			console.log('menuButtonInfo:', menuButtonInfo);

			this.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
				menuButtonInfo.height +
				systemInfo.statusBarHeight;
			console.log('this.globalData', this.globalData);
			
			//获取机型信息
			uni.getSystemInfo({
				success: (res) => {
					console.log('设备信息:', {
						brand: res.brand, // 设备品牌（如：apple）
						model: res.model, // 设备型号（如：iPhone 12）
						system: res.system, // 操作系统及版本（如：iOS 14.3）
						platform: res.platform, // 平台（ios/android）
						screenWidth: res.screenWidth,
						screenHeight: res.screenHeight,
						pixelRatio: res.pixelRatio,
						SDKVersion: res.SDKVersion // 微信基础库版本
					});

					// 可存储到全局或发送给服务端
					console.log("res",res)
				}
			});
			
			//验证
			uploadJugle()
			.then(res=>{
				const useStore = useMyStore();
				console.log("res777777",res)
				console.log("777777",useStore)
				useStore.setJungleCode((res?.data?.rspData) || '10000')
				// useStore.setJungleCode((2222) || '10000')
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import "@/uni_modules/uview-plus/index.scss";
	/*每个页面公共css */
</style>